// Evol scripts.
// Authors:
//    Reid
//    Travolta
// Description:
//    Sailor of Nard's La Johanne ship.
// ArtisQuests_QOnan -- quest variable:
//    0  - not started
//    1  - Q'Onan asked to find Chest
//    2  - Chest found, heading back to Q'Onan
//    3  - Quest completed

001-1,186,107,0	script	Q'Onan#001-1	NPC_QONAN,{

    .@q = getq(ArtisQuests_QOnan);
    if (.@q == 1) goto L_QuestGiven;
    if (.@q == 2) goto L_ItemFount;
    if (.@q == 3) goto L_QuestDone;

    speech 2,
        l("We didn't meet, right?"),
        l("My name is Q'Onan, I'm a member of Nard's crew."),
        l("I have a lot of work here, so I don't even have time to go to the town."),
        l("Could you do a small favour for me?");

    select l("Go on.");

    speech 3,
        l("Before I joined Nard, I used to be a thief."),
        l("I'm not proud of it, but I had to get money for living."),
        l("Anyway, the last time I stole something I was almost caught."),
        l("I robbed a nobleman, took a chest full of coins."),
        l("But my luck left me, because as soon as I left his house, the guards started chasing me."),
        l("It was at night, so I could barely escape. I ran to the Artis Hill."),
        l("I was afraid to be busted, so I decided to get rid of the evidence."),
        l("I buried the chest somewhere on that hill. It was dark, so I don't remember where to dig exactly."),
        l("I'm afraid to go there myself, but if you take the risk, you can have half of the loot."),
        l("So, what do you say?");

    menuint
        l("I like money! Consider it done."), 0,
        l("Too risky, I might end up in jail. Do it yourself."), 1;

    switch(@menuret)
    {
        case 0:
            setq ArtisQuests_QOnan, 1;
            getrandompoint(180,27,189,32);
            npcdebug "Chest buriad at (" + .move__rand_x + "," + .move__rand_y + ")";
            shovel_addquest("001-1", .move__rand_x, .move__rand_y, "QOnanFoundItem");
            speech 3,
                l("Alright, you will need this shovel."),
                l("I hope to see you soon.");
            getitem IronShovel, 1;
            close;
        case 1:
            speech 3,
                l("Come on, don't be a coward!"),
                l("Anyway, let me know if you change your mind.");
            close;
    }

L_QuestGiven:
    speech l("I asked you to do me a favour, so why are you here?");
    select l("What should I do, again?");
    speech 1,
        l("Please find the small chest, buried somewhere on the Artis Hill."),
        l("Bring it to me, and you will get your reward.");
    close;

L_ItemFount:
    speech
        l("After all this time, it was still there!"),
        l("We are very lucky, my friend."),
        l("Let me open it with my key."),
        l("Like I promised, here is your share."),
        l("I can finally pay off my debts.");
    // delitem SmallChest, 1;
    Zeny += 25000;
    setq ArtisQuests_QOnan, 3;
    close;

L_QuestDone:
    speech l("Howdy, partner in crime?");
    close;

OnInit:
    .sex = G_MALE;
    .distance = 2;
    .debug = 1;
    end;
}

function	script	QOnanFoundItem	{
    setq ArtisQuests_QOnan, 2;
    // getitem SmallChest, 1;
    narrator 1,
       l("You found a small chest, surprisingly heavy for it's size."),
       l("It's probably full of coins, but no matter how hard you try to open it, you can't."),
       l("Better take it back to Q'Onan.");
    return;
}
